#ifndef __GAMESPRITE_H__
#define __GAMESPRITE_H__
#include "cocos2d.h"
#include "cocos-ext.h"
#include "Box2D/Box2D.h"
#include "Common.h"
#include "GamePhySprite.h"
USING_NS_CC;
USING_NS_CC_EXT;

class GameSprite : public CCArmature, public GamePhySprite
{
public:
	GameSprite();
	~GameSprite();

//	static GameSprite* create(const char* name, b2World* world);

	virtual b2Body* CreateBody(b2World* world);

	void onPhyPosChange();

	void setPosition(const CCPoint &position);
	
	virtual EGameSpriteType getSpriteType(){ return EGS_Enemy;}
	EGameSpriteStatus getSpriteStatus() const { return m_eStatus; };
	void setSpriteStatus(EGameSpriteStatus eType) { m_eStatus = eType; }
	virtual void doAI() {};
	virtual void initPostion(const CCPoint& point) { setPosition(point); }
	template<class T>
	static T* create(b2World* pWorld)
	{
		static_assert(T::EnemyType < EE_cnt, "");
		static_assert(EE_cnt == _countof(gEnemyModel), "must equ");

		T* p = new T();
		if (p && p->init(gEnemyModel[T::EnemyType]))
		{
			p->CreateBody(pWorld);
			p->autorelease();
			return p;
		}

		CC_SAFE_DELETE(p);
		return NULL;
	}

private:
	EGameSpriteStatus m_eStatus;
};


#endif //__GAMESPRITE_H__